package net.huashitong.user.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.core.filter.Paging;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import com.sirdc.modules.utils.ObjectUtils;
import net.huashitong.Project.responseModel.MessageModel;
import net.huashitong.user.dao.MessageDao;
import net.huashitong.user.entity.Message;
import net.huashitong.user.filter.MessageFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageService extends StringPKService<Message> {
    @Autowired
    private MessageDao dao;

    @Override
    protected BaseDao<Message, String> getDao() {
        return dao;
    }

    @Autowired
    private SysTableService tableService;

    @Override
    protected void beforeSave(Message obj) {
        obj.setSysId(tableService.updateMaxSysId("t_bnp_message", null));
    }

    public List<Message> getMessageInfo(MessageFilter filter) {
        return dao.getMessageInfo(filter);
    }

    public List<MessageModel> getMessageByDate(String beginDate, String endDate) {
        return dao.getMessageByDate(beginDate, endDate);
    }
    public List<Message> getMessageModels(String projectName,String nodeId,String phone){
        return dao.getMessageModels(projectName,nodeId,phone);
    }

    /**
     * 查询消息列表（无分页）
     * @param filter
     * @return
     */
    public List<Message> getMessageInfoNoPage(MessageFilter filter) {
        return dao.getMessageInfoNoPage(filter);
    }

    public List<Message> queryMessageByIds(List<String> ids){
        return dao.queryMessageByIds(ids);
    }
}
